<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateAdminsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admins', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('store_id')->default(0)->comment('店铺id');
            $table->string('title', 60)->default('')->comment('用户名称');
            $table->tinyInteger('status')->default(1)->comment('用户状态，1正常，0禁用');
            $table->string('username', 60)->default('')->comment('用户名');
            $table->string('password', 255)->default('')->comment('密码');
            $table->integer('role_id')->default(0)->comment('role表的id ,如果找不到 , 则为默认用户 , 无法访问');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `admins` comment '后台管理员和店家表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admins');
    }
}
